package com.yhd.gmall.cart.config;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author yhd
 * @createtime 2020/9/26 21:34
 */
@Component
public class ThreadPoolConfig {

    @Bean
    public ThreadPoolExecutor threadPoolExecutor() {
        return new ThreadPoolExecutor(
                5,
                6,
                60,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(1)
        );
    }
}
